package com.wyp168.juc.cas;

import java.util.concurrent.atomic.AtomicInteger;

/**
 *@ClassName CompateAndSwapMethod
 *@Description TODO
 *@Author wyp168
 *@Date 2022/9/16 23:36
 */
public class CompareAndSwapMethodTest01 {
    public static void main(String[] args) {
        AtomicInteger atomicInteger = new AtomicInteger(1115);

        System.out.println(atomicInteger.compareAndSet(1115, 2022) + "\t---> " + atomicInteger.get());
        System.out.println(atomicInteger.compareAndSet(1115, 1020) + "\t---> " + atomicInteger.get());
    }
}
